package org.ushio.nchu_22201402.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.ushio.common_module.entity.CSSCR;
import org.ushio.common_module.entity.CustomerServiceRecord;

import java.util.List;

@Mapper
public interface CSSCRMapper extends BaseMapper<CSSCR> {

    @Update("update customer_service set Salary = Salary+#{SalaryUpdate} where Customer_Service_ID= #{Customer_Service_ID}")
    void UpdateSalaryRise(@Param("Customer_Service_ID")int Customer_Service_ID,@Param("SalaryUpdate")double SalaryUpdate);
    @Update("update customer_service set Salary = Salary+#{SalaryUpdate} where Customer_Service_ID= #{Customer_Service_ID}")
    void UpdateSalaryDown(@Param("Customer_Service_ID")int Customer_Service_ID,@Param("SalaryUpdate")double SalaryUpdate);
    @Insert("insert into csscr values(#{Customer_Service_ID},#{SalaryUpdate},#{ChangeTime})")
    void RecordUpdate(@Param("Customer_Service_ID")int Customer_Service_ID,@Param("SalaryUpdate")double SalaryUpdate,@Param("ChangeTime")String Date);
    @Select("select * from csscr")
    List<CSSCR> ListSalaryUpdate();
    @Select("select * from customer_service_record where Customer_Service_ID = #{Customer_Service_ID}")
    @Results({
            @Result(property = "serviceRecordId", column = "Service_Record_ID"),
            @Result(property = "conversationContent", column = "Conversation_Content"),
            @Result(property = "conversationStartTime", column = "Conversation_Start_Time"),
            @Result(property = "conversationEndTime", column = "Conversation_End_Time"),
            @Result(property = "rating", column = "Rating"),
            @Result(property = "complaint", column = "Complaint"),
            @Result(property = "phoneNumber", column = "Phone_Number"),
            @Result(property = "customerServiceId", column = "Customer_Service_ID")
    })
    List<CustomerServiceRecord> customerWhoWork(@Param("Customer_Service_ID")int Customer_Service_ID);
}
//SQL语句